<?php

if(!defined('IN_UCHOME')) {
	exit('Access Denied');
}

$unionid = empty($_GET['id'])?0:intval($_GET['id']);

$query = $_SGLOBAL['db']->query("SELECT uids FROM ".tname('union')." where id=".$unionid);
$union = $_SGLOBAL['db']->fetch_array($query);

if(in_array($_SGLOBAL['supe_uid'],explode(',',$union['uids']))){

	$query = $_SGLOBAL['db']->query("SELECT uid,username FROM ".UC_DBTABLEPRE."members WHERE uid IN('".$union['uids']."')");
	$autor_list = array();
	while($users = $_SGLOBAL['db']->fetch_array($query)) {
		realname_set($users['uid'], $users['username']);
		$autor_list[] = $user['uid'];
	}

	$unioninfolist = array();
	$query = $_SGLOBAL['db']->query("SELECT id,unionid,content,uid,dateline FROM ".tname('unioninfo')." where unionid=$unionid order by dateline desc");
	while($unioninfo = $_SGLOBAL['db']->fetch_array($query)) {
		$unioninfolist[] = $unioninfo;
	}
	realname_get();

}else{
	showmessage('do_success', 'space.php?do=home', 0);
}

include_once template("space_union");

?>